from sqlalchemy.ext.asyncio import AsyncSession
from module_admin.dao.business_dao import BusinessDao
from module_admin.entity.vo.business_vo import BusinessPageQueryModel
from module_admin.dao.machine_dao import MachineDao
from module_admin.entity.vo.machine_vo import MachineModel

class BusinessService:
    """
    营业记录模块服务层
    """

    @classmethod
    async def get_list_services(
        cls, query_db: AsyncSession, query_object: BusinessPageQueryModel, data_scope_sql: str, is_page: bool = False
    ):
        """
        获取列表信息service

        :param query_db: orm对象
        :param query_object: 查询参数对象
        :param data_scope_sql: 数据权限对应的查询sql语句
        :param is_page: 是否开启分页
        :return: 列表信息对象
        """
        # 获取数据
        query_result = await BusinessDao.get_list(query_db, query_object, data_scope_sql, is_page)

        return query_result
    
    @classmethod
    async def get_search_list_services(cls, query_db: AsyncSession, page_object: MachineModel, data_scope_sql: str):
        """
        获取机台信息service

        :param query_db: orm对象
        :param page_object: 查询参数对象
        :param data_scope_sql: 数据权限对应的查询sql语句
        :return: 部门机台列表对象
        """
        search_list_result = await MachineDao.get_machine_select_list(query_db, page_object, data_scope_sql)

        return search_list_result